﻿using Edge.Repository.Base;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Edge.Repository.Model
{


    /// <summary>
    /// 员工
    /// </summary>
    [SqlSugar.SugarTable("CS_User")]
    public class CS_User : BaseModel
    { 


        [SugarColumn(IsNullable = true)]
        public string Name { get; set; }

        [SugarColumn(IsNullable = true)]
        public string PassWord { get; set; }
 


        [SugarColumn(IsNullable = true)]
        public string UserType { get; set; }

        /// <summary>
        /// 1收费员，2磅房员工，3收费管理员，4泵房管理员 
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Admin { get; set; }

        [SugarColumn(IsNullable = true)]
        public string UserRemark { get; set; }





        /// <summary>
        ///  工号
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Code { get; set; }

        

        /// <summary>
        ///  工号
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string ClassName { get; set; }

        /// <summary>
        /// 0禁用，1 启用
        /// </summary>

        [SugarColumn(IsNullable = true)]
        public int status { get; set; }
         



    }



    /// <summary>
    ///  用户 
    /// </summary>
    public class UserService : BaseRepository<CS_User>
    {

    }

    public class UserDto
    {

        public int Id { get; set; }


        public string Name { get; set; }
        public int UserType { get; set; }
        public string UserTypeName
        {
            get
            {
                if (UserType == 1) { return "管理员"; }
                else if (UserType == 2) { return "超级管理员"; }
                else { return "员工"; }
            }
        }
        public string UserRemark { get; set; }

        public int GetType(string typeName)
        {
            if (typeName == "超级管理员") { return 2; }
            else if (typeName == "管理员") { return 1; }
            else { return 0; }

        }

    }
}
